-
Notifications
You must be signed in to change notification settings - Fork 151
Fix Phi long context issue #1504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
| # if config.model_type == "phi3" and config.max_position_embeddings != getattr( | ||
| # config, "original_max_position_embeddings", config.max_position_embeddings | ||
| # ): | ||
| # config.max_position_embeddings = config.original_max_position_embeddings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be deleted but I left it here for now for context.
| return attn_output, None, past_key_value | ||
|
|
||
|
|
||
| # @torch.jit.script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to add the test with long prompt. Is this issue reproduced on tiny-model?
I believe minor differences are expected on SPR. But if possible, WWB similarity should be run to see if the difference is significant or not. |
| return attn_output, None, past_key_value | ||
|
|
||
|
|
||
| # @torch.jit.script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove not needed comments and commented out code
This is #1297 updated to latest main branch.
Currently inference on Phi-3-mini and Phi-4-mini returns bad outputs (random characters) when context gets larger than about 2000 tokens. This PR, contributed by @eaidova , fixes that. This is not my code. The original PR is no longer being updated; I'm making this a new PR to make it easier to discuss and add updates.
I saw no negative impact on inference speed. I see slightly different outputs with shorter contexts on SPR (on inference with the model exported with the PR vs the model exported with main). Any suggestions to fix that would be much appreciated.
Draft PR for now, awaiting some feedback and testing, but I hope we can merge this soon.